<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@taglib prefix="s" uri="/struts-tags"%>

<h2 style="font-size: 30px; font-weight: bold; padding-left: 270px; padding-top:20px">User</h2>
<div class="form" style="float: left; width: 600px">
	<div class="form" style="">
		<s:form action="userlist" method="post" cssClass="niceform"  theme="simple" >
			<div style="padding-left:200px;color:#f00;font-size:15px;font-weight:bold;">${requestScope["errorregister"]}</div>
			<fieldset>
				<dl>
					<dt>
						<label>First Name:</label>
					</dt>
					<dd>
						<s:if test="%{#request.curUser != null && #request.curUser.getFirstName() != null}">
							<s:textfield type="text" name="userProfile.firstName" id="" size="54" value="%{#request.curUser.getFirstName()}" />
						</s:if>
						<s:else>
							<s:textfield type="text" name="userProfile.firstName" id="" size="54" value="" />
						</s:else>
					</dd>
				</dl>
				<dl>
					<dt>
						<label>Last Name:</label>
					</dt>
					<dd>
						<s:if test="%{#request.curUser != null && #request.curUser.getLastName() != null}">
							<s:textfield type="text" name="userProfile.lastName" id="" size="54" value="%{#request.curUser.getLastName()}" />
						</s:if>
						<s:else>
							<s:textfield type="text" name="userProfile.lastName" id="" size="54" value="" />
						</s:else>
					</dd>
				</dl>
				<dl>
					<dt>
						<label>Email:</label>
					</dt>
					<dd>
						<s:if test="%{#request.curUser != null && #request.curUser.getEmail() != null}">
							<s:textfield readonly="true" type="text" name="userProfile.email" id="" size="54" value="%{#request.curUser.getEmail()}" />
						</s:if>
						<s:else>
							<s:textfield readonly="true" type="text" name="userProfile.email" id="" size="54" value="" />
						</s:else>
					</dd>
				</dl>
				<dl>
					<dt>
						<label>Password:</label>
					</dt>
					<dd>
						<s:if test="%{#request.curUser != null && #request.curUser.getPassword() != null}">
							<s:textfield type="text" name="userProfile.password" id="" size="54" value="%{#request.curUser.getPassword()}" />
						</s:if>
						<s:else>
							<s:textfield type="text" name="userProfile.password" id="" size="54" value="" />
						</s:else>
					</dd>
				</dl>
				<dl>
					<dt>
						<label>ZIP Code:</label>
					</dt>
					<dd>
						<s:if test="%{#request.curUser != null && #request.curUser.getZipcode() != null}">
							<s:textfield type="text" name="userProfile.zipcode" id="" size="54" value="%{#request.curUser.getZipcode()}" />
						</s:if>
						<s:else>
							<s:textfield type="text" name="userProfile.zipcode" id="" size="54" value="" />
						</s:else>
					</dd>
				</dl>
				<dl>
					<dt>
						<label>Phone:</label>
					</dt>
					<dd>
						<s:if test="%{#request.curUser != null && #request.curUser.getPhoneNumber() != null}">
							<s:textfield type="text" name="userProfile.phoneNumber" id="" size="54" value="%{#request.curUser.getPhoneNumber()}" />
						</s:if>
						<s:else>
							<s:textfield type="text" name="userProfile.phoneNumber" id="" size="54" value="" />
						</s:else>
					</dd>
				</dl>
				<dl>
					<dt style="float: left">
						<label for="Rights">Select rights:</label>
					</dt>
					<dd>
						<select size="1" name="roles" id="rights" >
						<s:iterator value="#request.roles">
							<s:if test="%{getRole().equals(#request.curUser.getRoleses().iterator().next().getRole())}">
								<option selected="selected" value="<s:property value="getId()"/>"><s:property value="getRole()"/></option>
							</s:if>
							<s:else>
								<option value="<s:property value="getId()"/>"><s:property value="getRole()"/></option>
							</s:else>
						</s:iterator>
						</select>
					</dd>
				</dl>
				<dl>
					<dt>
						<label for="interests">Active:</label>
					</dt>
					<dd>
						<s:if test="%{#request.curUser.getEnable() == true}">
							<s:checkbox name="active" checked="checked" />
						</s:if> 
						<s:else>
							<s:checkbox name="active"/>
						</s:else>				
					</dd>
				</dl>

				<dl>
					<dt>
						<label></label>
					</dt>
				</dl>
				<s:submit key="" cssClass="button" name="btnsubmit" type="submit" value="SubmitEdit"></s:submit>
				
			</fieldset>
		</s:form>
	</div>
</div>